home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Other Langs / Tickle-4.0 (tcl) / library / help / tcl / files / select < prev    next >
Encoding:
Text File  |  1993-10-26  |  2.3 KB  |  48 lines  |  [TEXT/$Tcl]

  1.  
  2.  
  3.           select readfileIds ?writefileIds? ?exceptfileIds? ?timeout?
  4.                This command allows an Extended Tcl program to wait  on
  5.                zero  or  more files being ready for for reading, writ-
  6.                ing, have an exceptional condition pending,  or  for  a
  7.                timeout  period  to expire.  readFileIds, writeFileIds,
  8.                exceptFileIds are each lists of  fileIds,  as  returned
  9.                from  open, to query.  An empty list ({}) may be speci-
  10.                fied if a category is not used.
  11.  
  12.                The files specified by the readFileIds list are checked
  13.                to  see  if  data  is  available  for reading. The wri-
  14.                teFileIds are checked if the specified files are  clear
  15.                for  writing.   The exceptFileIds are checked to see if
  16.                an exceptional condition  has  occured  (typically,  an
  17.                error).   The write and exception checking is most use-
  18.                ful on devices, however, the read checking is very use-
  19.                ful  when communicating with multiple processes through
  20.                pipes.  Select considers  data  pending  in  the  stdio
  21.                input buffer for read files as being ready for reading,
  22.                the files do.  not have to be unbuffered.
  23.  
  24.                Timeout is a floating point timeout value, in  seconds.
  25.                If an empty list is supplied (or the parameter is omit-
  26.                ted), then no timeout is set.  If the  value  is  zero,
  27.                then  the  select  command  functions  as a poll of the
  28.                files, returning immediately even if none are ready.
  29.  
  30.                If the timeout period expires with none  of  the  files
  31.                becomming  ready,  then  the  command  returns an empty
  32.                list.  Otherwise the command returns a  list  of  three
  33.                elements,  each  of  those  elements  is  a list of the
  34.                fileIds that are ready in the read, write and exception
  35.                classes.   If none are ready in a class, then that ele-
  36.                ment will be the null list.  For example:
  37.  
  38.                        select {file3 file4 file5} {file6 file7} {} 10.5
  39.  
  40.                could return
  41.  
  42.                        {file3 file4} {file6} {}
  43.  
  44.                or perhaps
  45.  
  46.                        file3 {} {}
  47.  
  48.